package com.jnshu.ScheduleTask;

import com.jnshu.dao.UserTaskRelationMapper;
import com.jnshu.pojo.UserTaskRelation;
import lombok.extern.java.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @ClassName SaticScheduleTask
 * @Descrintion
 * @Author bd
 * @Date 2019/8/21 23:13
 * @Version 1.0
 **/
@Component
@Configuration
@Log
public class SaticScheduleTask {

    @Autowired(required = false)
    UserTaskRelationMapper userTaskRelationMapper;

    @Scheduled(cron = "0 0 0 * * ?")
    private void configureTasks() {
        log.info("开始执行定时器");
        //课程
        userTaskRelationMapper.updateStatus(0, 7L);
        //视频
        userTaskRelationMapper.updateStatus(0, 8L);
        //收藏
        userTaskRelationMapper.updateStatus(0, 9L);
    }
}
